package designPatterns.service.impl;


import designPatterns.PayServiceCapacityFactory;
import designPatterns.TypeEnum;

import java.util.Objects;

import static designPatterns.TypeEnum.OTHER;


public class Service {


    public void getPay(int type) {


        TypeEnum pay = TypeEnum.getPay(type);
        if (Objects.equals(pay.getType(), OTHER.getType())) {
            System.out.println("类型匹配" + pay.getType() + "" + pay.getDescription());
        }
        PayService payService = PayServiceCapacityFactory.getPayService(pay.getType());
        System.out.println(pay.getDescription());
        payService.pay();

    }


}
